#include <stdio.h>
#include<string.h>
int main()
{
	int boy = 0;
	int girl = 0;
	char n[256] = { 0 };
	int i;

	scanf("%s", n);
	int len = strlen(n);
	for (i = 0; i < len; i++)
	{
		if (n[i] == 'b' || n[i + 1] == 'o' || n[i + 2] == 'y')
			boy++;
		if (n[i] == 'g' || n[i + 1] == 'i' || n[i + 2] == 'r' || n[i + 3] == 'l')
			girl++;
	}
	printf("%d\n%d\n", boy, girl);
	return 0;
}